import type { Dayjs } from 'dayjs';

import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace HandCardsApi {
  /** 手牌管理信息 */
  export interface HandCards {
    id: number; // 主键ID
    cardNumber?: string; // 手牌号码
    cardType?: string; // 手牌类型
    status?: string; // 手牌状态
    teamId: string; // 团队ID
    roomNumber: string; // 房间号
    openTime: Dayjs | string; // 开牌时间
    totalConsumption: number; // 总消费金额
    remarks: string; // 备注信息
    icon: string; // 图标标识
  }
}

/** 查询手牌管理分页 */
export function getHandCardsPage(params: PageParam) {
  return requestClient.get<PageResult<HandCardsApi.HandCards>>(
    '/spa/hand-cards/page',
    { params },
  );
}

/** 查询手牌管理详情 */
export function getHandCards(id: number) {
  return requestClient.get<HandCardsApi.HandCards>(
    `/spa/hand-cards/get?id=${id}`,
  );
}

/** 新增手牌管理 */
export function createHandCards(data: HandCardsApi.HandCards) {
  return requestClient.post('/spa/hand-cards/create', data);
}

/** 修改手牌管理 */
export function updateHandCards(data: HandCardsApi.HandCards) {
  return requestClient.put('/spa/hand-cards/update', data);
}

/** 删除手牌管理 */
export function deleteHandCards(id: number) {
  return requestClient.delete(`/spa/hand-cards/delete?id=${id}`);
}

/** 批量删除手牌管理 */
export function deleteHandCardsList(ids: number[]) {
  return requestClient.delete(
    `/spa/hand-cards/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出手牌管理 */
export function exportHandCards(params: any) {
  return requestClient.download('/spa/hand-cards/export-excel', params);
}
